@license(LGPL);

//multi_domain
simple SCE
{
    parameters:
        int nodeId;
        int domainId;
    gates:
        input in[];
        output out[];
}

//simple Service_Processor_B{
//simple Service_Processor_C{

simple Node
{
    parameters:
        int gatewayth; //0 not gateway, 1 : the first gateway 2: the second gateway etc...
        int domainId;
        int SCENodeId;
        int nodeId;
    gates:
        input in[];
        output out[];
}

network ChinaTopology
{
    parameters:
        int rsvp_schemes_choosing;
    submodules:
        node0: Node {
            parameters:
                gatewayth = 0;
                domainId = 2;
                SCENodeId = 20;
                nodeId = 0;
                @display("p=644,174;i=misc/node_s,gold");
        }
        node1: Node {
            parameters:
                gatewayth = 0;
                domainId = 2;
                SCENodeId = 20;
                nodeId = 1;
                @display("p=536,198;i=misc/node_s,gold");
        }
        node2: Node {
            parameters:
                gatewayth = 1;
                domainId = 2;
                SCENodeId = 20;
                nodeId = 2;
                @display("p=416,244;i=misc/node_s,gold");
        }
        node3: Node {
            parameters:
                gatewayth = 1;
                domainId = 2;
                SCENodeId = 20;
                nodeId = 3;
                @display("p=536,290;i=misc/node_s,gold");
        }
        node4: Node {
            parameters:
                gatewayth = 0;
                domainId = 2;
                SCENodeId = 20;
                nodeId = 4;
                @display("p=592,232;i=misc/node_s,gold");
        }
        node5: Node {
            parameters:
                gatewayth = 0;
                domainId = 0;
                SCENodeId = 18;
                nodeId = 5;
                @display("p=60,174;i=misc/node_s,green");
        }
        node6: Node {
            parameters:
                gatewayth = 0;
                domainId = 0;
                SCENodeId = 18;
                nodeId = 6;
                @display("p=158,212;i=misc/node_s,green");
        }
        node7: Node {
            parameters:
                gatewayth = 1;
                domainId = 0;
                SCENodeId = 18;
                nodeId = 7;
                @display("p=272,234;i=misc/node_s,green");
        }
        node8: Node {
            parameters:
                gatewayth = 1;
                domainId = 0;
                SCENodeId = 18;
                nodeId = 8;
                @display("p=306,288;i=misc/node_s,green");
        }
        node9: Node {
            parameters:
                gatewayth = 0;
                domainId = 0;
                SCENodeId = 18;
                nodeId = 9;
                @display("p=150,342;i=misc/node_s,green");
        }
        node10: Node {
            parameters:
                gatewayth = 1;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 10;
                @display("p=644,396;i=misc/node_s,red");
        }
        node11: Node {
            parameters:
                gatewayth = 0;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 11;
                @display("p=528,466;i=misc/node_s,red");
        }
        node12: Node {
            parameters:
                gatewayth = 0;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 12;
                @display("p=492,504;i=misc/node_s,red");
        }
        node13: Node {
            parameters:
                gatewayth = 1;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 13;
                @display("p=402,429;i=misc/node_s,red");
        }
        node14: Node {
            parameters:
                gatewayth = 1;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 14;
                @display("p=182,388;i=misc/node_s,red");
        }
        node15: Node {
            parameters:
                gatewayth = 1;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 15;
                @display("p=344,344;i=misc/node_s,red");
        }

        node16: Node {
            parameters:
                gatewayth = 1;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 16;
                @display("p=498,338;i=misc/node_s,red");
        }

        node17: Node {
            parameters:
                gatewayth = 0;
                domainId = 1;
                SCENodeId = 19;
                nodeId = 17;
                @display("p=536,406;i=misc/node_s,red");
        }
        serverA: SCE {
            parameters:
                nodeId = 18;
                domainId = 0;
                @display("p=195,80;i=device/server,green");
        }
        serverB: SCE {
            parameters:
                nodeId = 19;
                domainId = 1;
                @display("p=370,108;i=device/server,red");
        }
        serverC: SCE {
            parameters:
                nodeId = 20;
                domainId = 2;
                @display("p=618,71;i=device/server,gold");
        }
    connections:
        //between server and node
        serverA.out++ --> {  delay = 100ms; } --> node5.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- node5.out++;

        serverA.out++ --> {  delay = 100ms; } --> node6.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- node6.out++;

        serverA.out++ --> {  delay = 100ms; } --> node7.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- node7.out++;

        serverA.out++ --> {  delay = 100ms; } --> node8.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- node8.out++;

        serverA.out++ --> {  delay = 100ms; } --> node9.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- node9.out++;

        serverB.out++ --> {  delay = 100ms; } --> node10.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node10.out++;

        serverB.out++ --> {  delay = 100ms; } --> node11.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node11.out++;

        serverB.out++ --> {  delay = 100ms; } --> node12.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node12.out++;

        serverB.out++ --> {  delay = 100ms; } --> node13.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node13.out++;

        serverB.out++ --> {  delay = 100ms; } --> node14.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node14.out++;

        serverB.out++ --> {  delay = 100ms; } --> node15.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node15.out++;

        serverB.out++ --> {  delay = 100ms; } --> node16.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node16.out++;

        serverB.out++ --> {  delay = 100ms; } --> node17.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- node17.out++;

        serverC.out++ --> {  delay = 100ms; } --> node0.in++;
        serverC.in++ <-- {  delay = 100ms; } <-- node0.out++;

        serverC.out++ --> {  delay = 100ms; } --> node1.in++;
        serverC.in++ <-- {  delay = 100ms; } <-- node1.out++;

        serverC.out++ --> {  delay = 100ms; } --> node2.in++;
        serverC.in++ <-- {  delay = 100ms; } <-- node2.out++;

        serverC.out++ --> {  delay = 100ms; } --> node3.in++;
        serverC.in++ <-- {  delay = 100ms; } <-- node3.out++;

        serverC.out++ --> {  delay = 100ms; } --> node4.in++;
        serverC.in++ <-- {  delay = 100ms; } <-- node4.out++;

        //between server and server
        serverA.out++ --> {  delay = 100ms; } --> serverB.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- serverB.out++;

        serverA.out++ --> {  delay = 100ms; } --> serverC.in++;
        serverA.in++ <-- {  delay = 100ms; } <-- serverC.out++;

        serverB.out++ --> {  delay = 100ms; } --> serverC.in++;
        serverB.in++ <-- {  delay = 100ms; } <-- serverC.out++;

        //between node and node(inside)
        node0.out++ --> {  delay = 100ms; } --> node1.in++;
        node0.in++ <-- {  delay = 100ms; } <-- node1.out++;

        node1.out++ --> {  delay = 100ms; } --> node2.in++;
        node1.in++ <-- {  delay = 100ms; } <-- node2.out++;

        node2.out++ --> {  delay = 100ms; } --> node3.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node3.out++;

        node3.out++ --> {  delay = 100ms; } --> node4.in++;
        node3.in++ <-- {  delay = 100ms; } <-- node4.out++;

        node4.out++ --> {  delay = 100ms; } --> node0.in++;
        node4.in++ <-- {  delay = 100ms; } <-- node0.out++;

        node1.out++ --> {  delay = 100ms; } --> node4.in++;
        node1.in++ <-- {  delay = 100ms; } <-- node4.out++;

        node2.out++ --> {  delay = 100ms; } --> node4.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node4.out++;

        node5.out++ --> {  delay = 100ms; } --> node6.in++;
        node5.in++ <-- {  delay = 100ms; } <-- node6.out++;

        node6.out++ --> {  delay = 100ms; } --> node7.in++;
        node6.in++ <-- {  delay = 100ms; } <-- node7.out++;

        node7.out++ --> {  delay = 100ms; } --> node8.in++;
        node7.in++ <-- {  delay = 100ms; } <-- node8.out++;

        node7.out++ --> {  delay = 100ms; } --> node9.in++;
        node7.in++ <-- {  delay = 100ms; } <-- node9.out++;

        node9.out++ --> {  delay = 100ms; } --> node5.in++;
        node9.in++ <-- {  delay = 100ms; } <-- node5.out++;

        node10.out++ --> {  delay = 100ms; } --> node11.in++;
        node10.in++ <-- {  delay = 100ms; } <-- node11.out++;

        node10.out++ --> {  delay = 100ms; } --> node15.in++;
        node10.in++ <-- {  delay = 100ms; } <-- node15.out++;

        node10.out++ --> {  delay = 100ms; } --> node16.in++;
        node10.in++ <-- {  delay = 100ms; } <-- node16.out++;

        node10.out++ --> {  delay = 100ms; } --> node17.in++;
        node10.in++ <-- {  delay = 100ms; } <-- node17.out++;

        node11.out++ --> {  delay = 100ms; } --> node13.in++;
        node11.in++ <-- {  delay = 100ms; } <-- node13.out++;

        node12.out++ --> {  delay = 100ms; } --> node13.in++;
        node12.in++ <-- {  delay = 100ms; } <-- node13.out++;

        node13.out++ --> {  delay = 100ms; } --> node14.in++;
        node13.in++ <-- {  delay = 100ms; } <-- node14.out++;

        node13.out++ --> {  delay = 100ms; } --> node15.in++;
        node13.in++ <-- {  delay = 100ms; } <-- node15.out++;

        node13.out++ --> {  delay = 100ms; } --> node16.in++;
        node13.in++ <-- {  delay = 100ms; } <-- node16.out++;

        node13.out++ --> {  delay = 100ms; } --> node17.in++;
        node13.in++ <-- {  delay = 100ms; } <-- node17.out++;

        node14.out++ --> {  delay = 100ms; } --> node15.in++;
        node14.in++ <-- {  delay = 100ms; } <-- node15.out++;

        node15.out++ --> {  delay = 100ms; } --> node16.in++;
        node15.in++ <-- {  delay = 100ms; } <-- node16.out++;

        node15.out++ --> {  delay = 100ms; } --> node17.in++;
        node15.in++ <-- {  delay = 100ms; } <-- node17.out++;

        node16.out++ --> {  delay = 100ms; } --> node17.in++;
        node16.in++ <-- {  delay = 100ms; } <-- node17.out++;

        //between node and node(outside)
        node2.out++ --> {  delay = 100ms; } --> node7.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node7.out++;

        node2.out++ --> {  delay = 100ms; } --> node8.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node8.out++;

        node2.out++ --> {  delay = 100ms; } --> node10.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node10.out++;

        node2.out++ --> {  delay = 100ms; } --> node13.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node13.out++;

        node2.out++ --> {  delay = 100ms; } --> node16.in++;
        node2.in++ <-- {  delay = 100ms; } <-- node16.out++;

        node3.out++ --> {  delay = 100ms; } --> node10.in++;
        node3.in++ <-- {  delay = 100ms; } <-- node10.out++;

        node7.out++ --> {  delay = 100ms; } --> node14.in++;
        node7.in++ <-- {  delay = 100ms; } <-- node14.out++;

        node8.out++ --> {  delay = 100ms; } --> node15.in++;
        node8.in++ <-- {  delay = 100ms; } <-- node15.out++;
}

